package progetto;

import peersim.config.Configuration;
import peersim.core.Control;

public class PermanImmuneValueInit implements Control{
	

    // ------------------------------------------------------------------------
    // Constants
    // ------------------------------------------------------------------------
	/**
	 * @config
	 */
	private static final String PAR_VALUE = "prob";
	
	 /**
     * The protocol to operate on.
     * 
     * @config
     */
    private static final String PAR_PROT = "protocol";
    
    private static final double DEF_VALUE = 1;
	
	// ------------------------------------------------------------------------
    // Fields
    // ------------------------------------------------------------------------
	/**
	 * Probability in percentage
	 * Obtained from config pr operty {@link #PAR_VALUE}.
	 */
	private final double value;
	
	/**
	 *  Protocol identifier; obtained from config property {@link #PAR_PROT}. 
	 *  
	 */
    //private final int pid;
	
	
	// ------------------------------------------------------------------------
    // Constructor
    // ------------------------------------------------------------------------
    public PermanImmuneValueInit(String prefix) {
    	//pid = Configuration.getPid(PAR_PROT);
    	double value = Configuration.getDouble(PAR_PROT, DEF_VALUE);
    	if(value > 100 || value < 0) {
    		this.value = DEF_VALUE;
    		System.err.println("Value of percentace of permanentry immunity not valid, used the default value: "+ DEF_VALUE);
    	} else
    		this.value = value;
    }
	
	// ------------------------------------------------------------------------
    // Methods
    // ------------------------------------------------------------------------

	@Override
	public boolean execute() {
		// TODO Auto-generated method stub
		return false;
	}

}
